//
//  PenyouquanViewController.m
//  即时通讯
//
//  Created by MK-MAC-001 on 15/9/21.
//  Copyright © 2015年 客官大大. All rights reserved.
//

#import "PenyouquanViewController.h"
#import "DWBubbleMenuButton.h"
@interface PenyouquanViewController ()

@end

@implementation PenyouquanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIImage *image1 = [UIImage imageNamed:@"iconfont-jiahao"];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:image1 style:UIBarButtonItemStylePlain target:self action:@selector(dede)];
    UIImage *im = [UIImage imageNamed:@"图片(1)"];
    UIImageView *o = [[UIImageView alloc] initWithFrame:CGRectMake(500, 0, 150, 50)];
    o.image = im;
    self.navigationItem.titleView = o;
    //    XiaoxiViewController *i = [[XiaoxiViewController alloc] init];
    //i.PreferredStatusBarStyle = UIStatusBarStyle.LightContent;
    
    //    [UIViewController alloc].preferredStatusBarStyle = UIStatusBarStyleLightContent;
    //    UIViewController.
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor]}];
    // Do any additional setup after loading the view from its nib.

    UILabel *homeLabel = [self createHomeButtonView];
    
    DWBubbleMenuButton *upMenuView = [[DWBubbleMenuButton alloc] initWithFrame:CGRectMake(285,
                                                                                         262,
                                                                                          25,
                                                                                          25)
                                                            expansionDirection:DirectionLeft];
    upMenuView.homeButtonView = homeLabel;
    
    [upMenuView addButtons:[self createDemoButtonArray]];
    
    [self.view addSubview:upMenuView];
    
    
    
      homeLabel = [self createHomeButtonView];
    
    DWBubbleMenuButton *upMenuView1 = [[DWBubbleMenuButton alloc] initWithFrame:CGRectMake(285,
                                                                                          443,
                                                                                          25,
                                                                                          25)
                                                            expansionDirection:DirectionLeft];
    upMenuView1.homeButtonView = homeLabel;
    
    [upMenuView1 addButtons:[self createDemoButtonArray]];
    
    [self.view addSubview:upMenuView1];




}
-(void)dede
{

}
- (void)test:(UIButton *)sender {
    NSLog(@"Button tapped, tag: %ld", (long)sender.tag);
}
- (BOOL)prefersStatusBarHidden {
    return true;
}
- (UIImageView *)createHomeButtonView {
//    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.f, 0.f, 20.f, 20.f)];
//    
//    label.text = @"+";
//    label.textColor = [UIColor whiteColor];
//    label.textAlignment = NSTextAlignmentCenter;
//    label.layer.cornerRadius = label.frame.size.height / 2.f;
//    label.backgroundColor =[UIColor colorWithRed:0.f green:0.f blue:0.f alpha:0.5f];
//    label.clipsToBounds = YES;
    UIImage *image = [UIImage imageNamed:@"iconfont-yuanquananniu"];
    UIImageView *i = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 25, 25)];
    i.image = image;
    
    
    return i;
}

- (NSArray *)createDemoButtonArray {
    NSMutableArray *buttonsMutable = [[NSMutableArray alloc] init];
    
    int i = 0;
    for (NSString *title in @[@"评论", @"赞"]) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
        
        [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        [button setTitle:title forState:UIControlStateNormal];
        button.titleLabel.font    = [UIFont systemFontOfSize: 12];
        button.frame = CGRectMake(0.f, 0.f, 30.f, 30.f);
        button.layer.cornerRadius = button.frame.size.height / 2.f;
//        button.backgroundColor = [UIColor colorWithRed:0.f green:0.f blue:0.f alpha:0.5f];
        button.clipsToBounds = YES;
        button.tag = i++;
        
        [button addTarget:self action:@selector(test:) forControlEvents:UIControlEventTouchUpInside];
        
        [buttonsMutable addObject:button];
    }
    
    return [buttonsMutable copy];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
